package com.bosi.exmple.chat;

import com.bosi.exmple.chat.handler.OpenOrCloseHandler;
import com.bosi.exmple.chat.handler.PushHandler;
import com.bosi.exmple.chat.handler.TestHandler;
import com.bosi.message.MessageService;
import com.bosi.message.impl.SimpleMessageService;
import com.bosi.exmple.ws.server.FastNettyWebSocketServer;

/**
 * 聊天室示例
 */
public class Main {

    public static void main(String[] args) {
        MessageService messageService = new SimpleMessageService();

        ChatWebSocket socket = new ChatWebSocket();
        socket.put("open",new OpenOrCloseHandler(messageService));
        socket.put("push",new PushHandler(messageService));
        socket.put("close",new OpenOrCloseHandler(messageService));
        socket.put("test",new TestHandler(messageService));
        new FastNettyWebSocketServer(socket).listener(8080);
    }
}
